package cn.livingCloud.service.impl;

import cn.livingCloud.dto.SelfBindingListDto;
import cn.livingCloud.dto.front.SelfBindingFrontFormDto;
import cn.livingCloud.repository.SelfBindingMapper;
import cn.livingCloud.service.SelfBindingService;
import cn.livingCloud.service.impl.operation.SelfBindingDtoCreator;
import cn.livingCloud.service.impl.operation.SelfBindingFrontFromDtoLoader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by DingJie on 2016/6/23.
 */
@Service
public class SelfBindingServiceImpl implements SelfBindingService {
    @Autowired
    private SelfBindingMapper mapper;

    @Override
    public void loadSelfBindingListDto(SelfBindingListDto listDto) {
        listDto.addAllList(mapper.getList(listDto));
    }

    @Override
    public boolean Binding(String uuid) {
        SelfBindingDtoCreator creator = new SelfBindingDtoCreator(uuid);
        return creator.create();
    }

    @Override
    public SelfBindingFrontFormDto loadSelfBindingFrontDto() {
        return new SelfBindingFrontFormDto();
    }

    @Override
    public void saveSelfBindingFrontFormDto(SelfBindingFrontFormDto formDto) {
        SelfBindingFrontFromDtoLoader loader = new SelfBindingFrontFromDtoLoader(formDto);
        loader.loader();
    }
}
